Skip to content

feat(gui): Add user option to adjust scale of game fonts in relation to resolution#1457

Merged
xezon merged 1 commit into
TheSuperHackers:mainfrom
Mauller:feat-user-font-adjust
Sep 12, 2025
Merged

feat(gui): Add user option to adjust scale of game fonts in relation to resolution#1457
xezon merged 1 commit into
TheSuperHackers:mainfrom
Mauller:feat-user-font-adjust

Conversation

@Mauller

@Mauller Mauller commented Aug 14, 2025

Copy link
Copy Markdown

This PR adds user based font scaling adjustment to the game.

The value can be set within the options.ini by setting ResolutionFontAdjustment = 10 etc, where the value is a percentage increase, the default being 0% of the original scale.

This value acts on the normal ini based resolution scaling to give some user flexibility.


TODO:

  • Replicate in generals

@Mauller Mauller self-assigned this Aug 14, 2025
@Mauller Mauller added Enhancement Is new feature or request GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker Gen Relates to Generals ZH Relates to Zero Hour labels Aug 14, 2025
@Mauller Mauller force-pushed the feat-user-font-adjust branch from 828eaa2 to b632b27 Compare August 14, 2025 19:00
@Mauller

Mauller commented Aug 14, 2025

Copy link
Copy Markdown
Author

Tweaked some naming but theres likely going to be the odd bit of name tweaking still.

Comment thread GeneralsMD/Code/GameEngine/Include/GameClient/GlobalLanguage.h Outdated
@Mauller Mauller force-pushed the feat-user-font-adjust branch from b632b27 to 654b37e Compare August 15, 2025 13:41

@xezon xezon left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to merge this change before the other, so we can experiment with this.

@Mauller

Mauller commented Aug 27, 2025

Copy link
Copy Markdown
Author

I suggest to merge this change before the other, so we can experiment with this.

i will tweak and rebase this on main so it can be merged independent of other font scaling tweaks.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 654b37e to 5b6391f Compare August 31, 2025 09:14
@Mauller

Mauller commented Aug 31, 2025

Copy link
Copy Markdown
Author

Rebased, removed the other font scaling stuff and tweaked based on feedback.

This now will not scale the font if the value is set to zero, which i have set as the default.

@xezon

xezon commented Aug 31, 2025

Copy link
Copy Markdown

This is not what I meant :)

adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment * TheGlobalData->m_resolutionFontAdjustment; was fine, because if TheGlobalData->m_resolutionFontAdjustment is 0, then the adjust factor simply will be one: no resolution scaling, text has same size as with 800 x 600

* (1 + TheGlobalData->m_resolutionFontAdjustment) is misleading, because 1 becomes 2 (doubling).

@Mauller

Mauller commented Aug 31, 2025

Copy link
Copy Markdown
Author

This is not what I meant :)

adjustFactor = 1.0f + (adjustFactor-1.0f) * m_resolutionFontSizeAdjustment * TheGlobalData->m_resolutionFontAdjustment; was fine, because if TheGlobalData->m_resolutionFontAdjustment is 0, then the adjust factor simply will be one: no resolution scaling, text has same size as with 800 x 600

* (1 + TheGlobalData->m_resolutionFontAdjustment) is misleading, because 1 becomes 2 (doubling).

Yeah i thought you meant that zero would result in the extra user option not having any effect on the current scaling.
So the game essentially just scales like it normally would.

Also this is the game with just the raw Font sizes, so m_resolutionFontAdjustment at zero
image

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 5b6391f to d1843fa Compare August 31, 2025 14:37
@Mauller

Mauller commented Aug 31, 2025

Copy link
Copy Markdown
Author

Tweaked and pushed.

@xezon

xezon commented Aug 31, 2025

Copy link
Copy Markdown

One more thought: If a user sets the scale to 1, then we would expect a linear scale. But instead it would "secretly" scale by 0.7 * 1. I wonder if we should do something about that.

@Mauller

Mauller commented Aug 31, 2025

Copy link
Copy Markdown
Author

One more thought: If a user sets the scale to 1, then we would expect a linear scale. But instead it would "secretly" scale by 0.7 * 1. I wonder if we should do something about that.

Should we override whatever m_resolutionFontSizeAdjustment is set to with the user set option? But take whatever m_resolutionFontSizeAdjustment is as the default?

Situation here ends up a bit like what the scroll Anchor PR is doing.
We consider the user option to be the source of truth and the ini value as the default.

@xezon

xezon commented Aug 31, 2025

Copy link
Copy Markdown

Maybe start m_resolutionFontSizeAdjustment as -1 and if it less than 0 then we use Language.ini settings, otherwise user setting. Not sure.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from d1843fa to 37ee9c5 Compare September 3, 2025 18:37
@Mauller

Mauller commented Sep 3, 2025

Copy link
Copy Markdown
Author

So tweaked this now so by default, for this PR, the user based setting does not adjust the default from languages.ini

Comment thread GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp Outdated
Comment thread GeneralsMD/Code/GameEngine/Include/Common/UserPreferences.h Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp Outdated
Comment thread GeneralsMD/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp Outdated
@Mauller Mauller force-pushed the feat-user-font-adjust branch from 37ee9c5 to 1105ede Compare September 4, 2025 19:00
@Mauller

Mauller commented Sep 4, 2025

Copy link
Copy Markdown
Author

Tweaked based on some of the feedback.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 1105ede to 2c6ada7 Compare September 4, 2025 20:03
@Mauller

Mauller commented Sep 4, 2025

Copy link
Copy Markdown
Author

Tweaked now so the GlobalLanguage reads from the options.ini and loads the value locally.

The options menu then reads from the options ini and sets the value in GlobalLanguage

@Mauller

Mauller commented Sep 5, 2025

Copy link
Copy Markdown
Author

will replicate to generals later if we think this is good to go now.

Comment thread GeneralsMD/Code/GameEngine/Include/GameClient/GlobalLanguage.h Outdated
@Mauller Mauller force-pushed the feat-user-font-adjust branch from 2c6ada7 to 8845a00 Compare September 5, 2025 14:57
@Mauller

Mauller commented Sep 5, 2025

Copy link
Copy Markdown
Author

Tweaked and replicated to generals

Comment thread Generals/Code/GameEngine/Source/GameClient/GlobalLanguage.cpp Outdated
@Mauller Mauller force-pushed the feat-user-font-adjust branch from 8845a00 to 72e16f6 Compare September 9, 2025 17:51
@Mauller

Mauller commented Sep 9, 2025

Copy link
Copy Markdown
Author

Tweaked and pushed.

@Mauller Mauller force-pushed the feat-user-font-adjust branch from 72e16f6 to 0188f49 Compare September 10, 2025 17:45
@xezon xezon changed the title feat(gui): implement user based font scaling feat(gui): Add user option to adjust scale of game fonts in relation to resolution Sep 12, 2025
@xezon xezon merged commit 40ac1c0 into TheSuperHackers:main Sep 12, 2025
19 checks passed
@xezon xezon deleted the feat-user-font-adjust branch September 12, 2025 06:10
@ElTioRata

Copy link
Copy Markdown

GUIEdit doesn't start anymore after this PR.

@xezon

xezon commented Sep 14, 2025

Copy link
Copy Markdown

@Mauller Can you check please?

@Mauller

Mauller commented Sep 14, 2025

Copy link
Copy Markdown
Author

It opens and runs perfectly fine for me when building it locally.

@Mauller

Mauller commented Sep 14, 2025

Copy link
Copy Markdown
Author

So opening the build artifact, it's crashing when trying to retrieve the user path to the game options in global languages

@Mauller

Mauller commented Sep 14, 2025

Copy link
Copy Markdown
Author

This seems to only be a VC6 issue

@Mauller

Mauller commented Sep 14, 2025

Copy link
Copy Markdown
Author

Think i may have figured it out now, global languages is initialised before global data in guiedits init function.
just re-arranged to test.

Interesting that VS22 builds are immune to this if it starts working for VC6.

fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Nov 10, 2025
…to resolution (TheSuperHackers#1457)

Adds new option ResolutionFontAdjustment=0..100 to Options.ini
fbraz3 pushed a commit to fbraz3/GeneralsX that referenced this pull request Feb 23, 2026
…to resolution (TheSuperHackers#1457)

Adds new option ResolutionFontAdjustment=0..100 to Options.ini
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Is new feature or request Gen Relates to Generals GUI For graphical user interface Minor Severity: Minor < Major < Critical < Blocker ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants